<div class="worker-info work-info-detail main shadowbox equipmentInfoDetail">
  <div class="container-header">设备信息查看
    <div class="pa-btn go-back" ng-click="goBack();">
      <i class="fa fa-reply"></i>
      <span class="ml5">返回</span>
    </div>
  </div>
  <div class="info-items info-vendor">
    <div class="info-title">
      <span class="title-brief">基本信息</span>
      <div class="edit">
        <div class="info-pencil"
          ng-click="vm.baseInfoEventHandler.toggleEditable()">
          <div ng-hide="vm.editable">  
            <i class="fa fa-pencil"></i>
            <span>编辑</span>
          </div>
          <div ng-show="vm.editable">
            <i class="fa fa-reply"></i>
            <span>取消</span> 
          </div>
        </div>
      </div>
    </div>
    <form class="base-info pa-form-content"
      ng-class="{'editable':vm.editable}"
      name="equipInfo"  role="form" novalidate="" autocomplete="off">
      <div class="row-fl fl">
        <div class="row-item">
          <div class="pa-form-control pa-base-form-control">
            <label class="fl"><b>*</b>设备名称：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" name="deviceName" required 
                ng-model="vm.editableEquipmentInfo.deviceName" />
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.deviceName}}
            </div>
            <span class="mandatory"
              ng-show="(equipInfo.$submitted || equipInfo.deviceName.$dirty) && equipInfo.deviceName.$error.required">
              必填
            </span>
          </div>
          <div class="pa-form-control pa-base-form-control">
            <label class="fl">内部编号：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" 
                ng-model="vm.editableEquipmentInfo.innerNo" />
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.innerNo}}
            </div>
          </div>
          <div class="pa-form-control pa-base-form-control">
            <label class="fl">设备型号：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" ng-model="vm.editableEquipmentInfo.deviceModel"/>
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.deviceModel}}
            </div>
          </div>
        </div>
        <div class="row-item">
          <div class="pa-form-control pa-base-form-control">
            <label class="fl">使用地点：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" ng-model="vm.editableEquipmentInfo.usingSites" />
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.usingSites}}
            </div>
          </div>
          <div class="pa-form-control pa-base-form-control">
            <label class="fl">牌照：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" ng-model="vm.editableEquipmentInfo.license"  />
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.license}}
            </div>
          </div>
          <div class="pa-form-control pa-base-form-control">
            <label class="fl"><b>*</b>设备等级：</label>
            <div class="pa-input pa-input-edit fl">
              <select name="deviceLevel" required
                ng-model="vm.editableEquipmentInfo.deviceLevel">
                <option value="1"
                  ng-selected="vm.equipmentInfo.deviceLevel == 1">
                  一般设备
                </option>
                <option value="2" 
                  ng-selected="vm.equipmentInfo.deviceLevel == 2">
                  主要设备
                </option>
                <option value="4"
                  ng-selected="vm.equipmentInfo.deviceLevel == 4">
                  特种设备
                </option>
              </select>
            </div>
            <div class="pa-input pa-input-unedit">
              {{vm.equipmentInfo.deviceLevel_}}
            </div>
            <span class="mandatory"
              ng-show="(equipInfo.$submitted || equipInfo.deviceLevel.$dirty) && equipInfo.deviceLevel.$error.required">
              必填
            </span>
          </div>        
        </div>
        <div class="row-item"> 
         <div class="pa-form-control pa-base-form-control">
            <label class="fl">操作人员：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text"
                ng-model="vm.editableEquipmentInfo.operator"  />
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.operator}}
            </div>
          </div>                 
          <div class="pa-form-control pa-base-form-control">
            <label class="fl"><b>*</b>进场时间：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" ng-datepicker name="approachTime" required 
                ng-model="vm.editableEquipmentInfo.approachTime">
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.approachTime}}
            </div>
            <span class="mandatory"
              ng-show="(equipInfo.$submitted || equipInfo.approachTime.$dirty) && equipInfo.approachTime.$error.required">
              必填
            </span>
          </div>
          <div class="pa-form-control pa-base-form-control">
            <label class="fl">退场时间：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" ng-datepicker 
                ng-model="vm.editableEquipmentInfo.exitTime">
            </div>
            <div class="pa-input pa-input-unedit">
              {{vm.equipmentInfo.exitTime}}
            </div>
          </div>
        </div>
        <div class="row-item">
          <div class="pa-form-control pa-base-form-control">
            <label class="fl"><b>*</b>维保情况：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="text" name="maintainSituation" required 
                ng-model="vm.editableEquipmentInfo.maintainSituation"/>
            </div>
            <div class="pa-input pa-input-unedit">{{vm.equipmentInfo.maintainSituation}}
            </div>
            <span class="mandatory"
              ng-show="(equipInfo.$submitted || equipInfo.maintainSituation.$dirty) && equipInfo.maintainSituation.$error.required">
              必填
            </span>
          </div>        
          <div class="pa-form-control pa-base-form-control">
            <label class="fl">是否租赁：</label>
            <div class="pa-input pa-input-edit fl">
              <input type="radio" class="sex-checkbox" name="gender"
              value="1" ng-model="vm.editableEquipmentInfo.isRented" />是
              <input type="radio" class="sex-checkbox" name="gender"
              value="0" ng-model="vm.editableEquipmentInfo.isRented" />否
            </div>
            <div class="pa-input pa-input-unedit">
              {{vm.equipmentInfo.isRented == '1' ? '是' : 
              vm.equipmentInfo.isRented == '0' ? '否' : ''}}
            </div>
          </div>       
        </div>
      </div>
      <div class="row-fr">
        <div class="img-box" style="margin:0;">
          <!-- 展示头像和文件 -->
          <div class="avatar-upload-outer" ng-show="!vm.editable">
            <img class="avatar-img"
              ng-src="{{vm.baseInfoEventHandler.getAvatarSrc()}}"/>
          </div>
          <avatar-upload
            ng-show="vm.editable"
            component-id="cp1"
            pick-btn-id="avatar_picker"
            upload-url="{{fileUploadUrl.device}}" 
            image-file="vm.editableEquipmentInfo.fileBean">
          </avatar-upload>
        </div>
      </div>           
    </form>
    <div class="btn-outer"  ng-show="vm.editable">
      <a class="pa-btn"
        authorization-btn="api/deviceinfo/updateDeviceInfo"
        ng-click="vm.baseInfoEventHandler.save(equipInfo)">
        <i class="fa fa-save" ></i>
        <span class="ml5">保存</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="vm.baseInfoEventHandler.reset()">
        <i class="fa fa-repeat"></i>
        <span class="ml5">重置</span>
      </a>
    </div>
  </div>
  <div class="info-items">
    <div class="info-title">
      <span class="title-brief">验收记录</span>
      <div class="edit-add" ng-click="vm.toggleAcceptanceEditable()">
        <i class="fa fa-plus"></i>
        <span>{{vm.acceptanceEditable ? '取消' : '编辑'}}</span>
      </div>
    </div>
    <div class="equipInfo-content img-uploader-outer">
      <div class="img-box" ng-repeat="item in vm.editableEquipmentInfo.fileBeans">
        <img ng-src="{{vm.getAcceptanceImgSrc(item)}}"/>
        <i class="fa fa-remove"
          ng-show="vm.acceptanceEditable"
          ng-click="vm.deleteAcceptanceImage(item)"></i>
        <div>
          <div class="toast success">上传成功</div>
          <div class="toast error">上传失败</div>
          <div class="retry">
            <i class="fa fa-repeat"></i>
          </div>
        </div>
      </div>
      <div class="img-box add-acceptanceRecord" id="uploader-demo"
        ng-show="vm.acceptanceEditable">
        <img/>
        <i class="fa fa-add-one"></i>
        <i class="fa fa-add-two"></i>
        <div id="acceptancePicker" style="position: absolute;top:0;width:100%;height:100%;"></div>
      </div>
      <div class="promt-msg" ng-show="vm.acceptanceEditable">
        图片格式：gif,jpg,jpeg,bmp,png
      </div>
      <div class="btn-outer" ng-show="vm.acceptanceEditable" style="padding-bottom: 20px;">
        <a class="pa-btn" ng-click="vm.saveAcceptanceImage()">
          <i class="fa fa-save"></i>
          <span class="ml5">保存</span>
        </a>
        <a class="pa-btn reset-btn" ng-click="vm.toggleAcceptanceEditable()">
          <i class="fa fa-repeat"></i>
          <span class="ml5">取消</span>
        </a>
      </div>
      <!-- <equipment-attachment-upload
        component-id="equipment_attachment_uploader"
        pick-btn-id="equipment_attachment_uploader_picker"
        upload-url="{{fileUploadUrl.device}}"
        file-list="vm.editableEquipmentInfo.fileBeans"
        >
      </equipment-attachment-upload> -->
    </div>
  </div>
  <div class="info-items">
    <div class="info-title">
      <span class="title-brief">检验记录</span>    
      <div class="edit-add"
        authorization-btn="api/devicecheckrecord/insertCheckRecord"
        ng-click="vm.addCheckRecord()">
        <i class="fa fa-plus"></i>
        <span>新增</span>
      </div>  
    </div> 
    <div class="equipInfo-content">
      <div class="equipInfo-item" ng-repeat="item in vm.checkRecordList">
        <div class="equipInfo-brief">
          <div class="brief-item">
            <label>检测时间：</label>
            <div class="brief-result">{{item.checkTime}}</div>
          </div>
          <div class="brief-item">
            <label>下次检测时间：</label>
            <div class="brief-result">{{item.nextChecktime}}</div>
          </div>
          <div class="brief-item">
            <label>检测结果：</label>
            <div class="brief-result">
              {{item.checkResult == 1 ? '合格' : item.checkResult == 2 ? '不合格' : '待定'}}
            </div>
          </div>
        </div>
        <div class="equipInfo-record-show">
          <div class="img-box"
            ng-repeat="image in item.fileBeans">
            <img ng-src="{{vm.getCheckRecordSrc(image)}}"/>
          </div>
          <a class="btn btn-history-code">历史检测记录</a>
          <!-- 添加按钮 -->
        </div>
        <div class="equipInfo-delete"
          authorization-btn="api/devicecheckrecord/deleteCheckRecord"
          ng-click="vm.deleteCheckRecord(item.id)">
          <i class="fa fa-trash"></i>
        </div>        
      </div>
    </div>  
  </div>
  <div class="info-items">
    <div class="info-title"><span class="title-brief">维保记录</span>
      <div class="edit-add" ng-click="vm.addMainRecord()" ng-show="!vm.addRecord">
        <i class="fa fa-plus"></i>
        <span>新增</span>
      </div> 
      <div class="edit-add" ng-click="vm.addMainRecord()" ng-show="vm.addRecord">
        <i class="fa fa-minus"></i>
        <span>取消新增</span>
      </div> 
    </div>   
    <form class="base-info pa-form-content"
      ng-show="!vm.typeofWork">
      <div class="problems-list-outer">
        <table class="pa-table">
          <thead>
            <tr>
              <th>维保时间</th>
              <th>维保内容</th>
              <!-- <th>备注</th> -->
              <th>操作</th>
            </tr>
          </thead>
           <tbody>
            <tr ng-repeat = "item in vm.maintainRecordList" ng-class="{'editRecord':item.record}">
              <td>
                <div class="pa-input-unedit">
                  {{item.maintainTime}}
                </div>
                <div class="pa-input-edit">
                  <input type="text" class="form-control" ng-datepicker
                    ng-model="vm.editableMaintainRecordList[$index].maintainTime" />
                </div>
              </td>
              <td>
                <div class="pa-input-unedit">
                  {{item.maintainContent}}
                </div>
                <div class="pa-input-edit">
                  <input type="text" class="form-control"
                    ng-model="vm.editableMaintainRecordList[$index].maintainContent" />
                </div>
              </td> 
<!--               <td>
                <div class="pa-input-unedit">
                  {{item.remark}}
                </div>
                <div class="pa-input-edit">
                  <input type="text" class="form-control"
                    ng-model="vm.editableMaintainRecordList[$index].remark" />
                </div>
              </td>  -->                                                         
              <td>
                <div ng-show="!item.record">
                  <div class="edit-item"
                    ng-click="vm.editRecord(item, $index)">
                    <i class="fa fa-pencil"></i>
                    <span>编辑</span>
                  </div>
                  <div class="edit-item"
                    authorization-btn="api/devicemaintainrecord/deleteMaintainRecord"
                    ng-click="vm.recordDetete(item)">
                    <i class="fa fa-trash"></i>
                    <span>删除</span> 
                  </div>
                </div>
                <div ng-show="item.record">
                  <div class="edit-item"
                    authorization-btn="api/devicemaintainrecord/updateMaintainRecord"
                    ng-click="vm.saveRecordItem(item, $index)">
                    <i class="fa fa-save"></i>
                    <span>保存</span>
                  </div>
                  <div class="edit-item">
                    <div class="edit-item" ng-click="vm.cancelRecord(item, $index)">
                      <i class="fa fa-reply"></i>
                      <span>取消</span>
                    </div>
                  </div>
                </div>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </form>
    <form name="addForm" novalidate 
      ng-show="vm.addRecord" style="padding-bottom: 60px">
      <div class="row-item">
        <div class="fl">
          <label class="maintenance-item"><b>*</b>维保时间：</label>
          <div class="pa-input maintenance-item">
            <input type="text" ng-datepicker name="maintainTime" required 
              ng-model="vm.maintainRecordData.maintainTime" />
          </div>
          <span style="line-height: 28px;color: #fd8c71;font-size: 12px;"
            ng-show="(addForm.$submitted || addForm.maintainTime.$dirty) && addForm.maintainTime.$error.required">
            必填
          </span>
        </div>
        <div class="fl">
          <label class="maintenance-item"><b>*</b>维保内容：</label>
          <div class="pa-input maintenance-item">
            <input type="text" name="maintainContent" required
              ng-model="vm.maintainRecordData.maintainContent" />
          </div>
          <span style="line-height: 28px;color: #fd8c71;font-size: 12px;"
            ng-show="(addForm.$submitted || addForm.maintainContent.$dirty) && addForm.maintainContent.$error.required">
            必填
          </span>
        </div>
        <!-- <div class="pa-form-control">
          <label for="">备注：</label>
          <div class="pa-input">
            <input type="text" class="form-control" ng-model="vm.recordList.note" />
          </div>
        </div> -->
        <div class="fl">
          <a class="pa-btn" style="margin:10px;"
            authorization-btn="api/devicemaintainrecord/insertMaintainRecord"
            ng-click="vm.addItemRecord(addForm)">
            <i class="fa fa-plus"></i>
            <span class="ml5">增加</span>
          </a>
          <a class="pa-btn" style="margin:10px;"
            ng-click="vm.cancelAddMaintainRecord()">
            <i class="fa fa-times"></i>
            <span class="ml5">取消</span>
          </a>
        </div>       
      </div>
    </form>
  </div>
</div>